import http from './public'
// 拿到商品列表
export function getAllGoods(data) {
  return http.fetchGet(
   'admin/goods/'+data.page+'?limit='+data.limit+'&tab='+data.tab,
  )
}

// 查询关键字列表
export function getSearch(data) {
  return http.fetchGet(
    'admin/goods/'+data.page+'?limit='+data.limit+'&tab=all&title='+data.title
  )
}
// 分类列表
export function getTypeList(data) {
  return http.fetchGet(
    'admin/imageclass/69/image/1?limit=10&order=desc'
  )
}

// 鞋子在售列表
export function getShoesList(data) {
  return http.fetchGet(
    'admin/goods/1?limit=50&tab=all&category_id=232'
  )
}

// 数码产品列表
export function getDigitProducts(data) {
  return http.fetchGet(
    'admin/goods/1?limit=50&tab=all&category_id=235'
  )
}

// 美妆产品列表
export function getBeautyList(data) {
  return http.fetchGet(
    'admin/goods/1?limit=50&tab=all&category_id=237'
  )
}

//包包配饰列表
export function getBagList(data) {
  return http.fetchGet(
    'admin/goods/1?limit=50&tab=all&category_id=238'
  )
}
// 加入购物车
export function addCart(data) {
  return http.fetchPost(
    'api/cart',
    data
  )
}
// 购物车下单
export function order(data) {
  return http.fetchPost(
    'api/order',
    data
  )
}
// 查看商品详情
export function productDet(id) {
  return http.fetchGet(
    'admin/goods/read/'+id
  )
}

// 查看订单列表
export function orderList() {
  return http.fetchPost(
    'api/order/all'
  )
}
// 查看订单详情
export function getOrderDet(orderId) {
  return http.fetchGet(
    'api/api/order/'+orderId
  )
}

//取消订单 
export function cancelOrder(orderId) {
  return http.fetchPost(
    'api/closeorder/'+orderId.orderId,
    orderId
  )
}

//申请退款
export function refund(data) {
  return http.fetchPost(
    'api/order/'+data.orderId+'/apply_refund',
    data
  )
}
